import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 28463
 * Date: 2022—05—07
 * Time: 9:03
 */

public class TestDemo01 {
    /*
        public static void transform(int array1[]){
            for (int i = 0; i < array1.length; i++) {
                array1[i]=2*array1[i];
                System.out.print(array1[i]+" ");
            }
        }
    *//*

    public static void transform(int array1[]) {
        for(int x : array1){
            System.out.print(2*x + " ");
        }
    }
    public static void main(String[] args) {
        int[] array = {1,2,3};
        transform(array);
    }*/
/*public static void main(String[] args) {
    int [] array1 = new int[100];
    for (int i = 1; i <= array1.length; i++) {
        System.out.print(i+" ");
    }
}*/
/*public static void main(String[] args) {
    int[] nums = {7,1,2,15};
    int target = 9;
    for (int i = 0; i < nums.length; i++) {
        if(nums[i]+nums[i+1] == target){
            System.out.println(i+" "+(i+1));
            break;
        }
    }
}*/
/*    public static int[] TwoSum(int[] nums,int target){
        for (int i = 0; i < nums.length; i++) {
            for (int j = 0; j < nums.length; j++) {
                if((i != j)&&(nums[i]+nums[j] == target)){
                    return new int[] {i,j};
                }

            }
        }
        return new int[] {0,0};
    }
public static void main(String[] args) {
    int[] arr1 = {7,1,2,15};
    int target = 9;
    System.out.println(Arrays.toString(TwoSum(arr1, target)));
}*/
/*public static void ArraySorting(int[] array1){
    //i控制趟数
    for (int i = 0; i < array1.length-1; i++) {
        //j每一趟都从0开始
        for (int j = 0; j < array1.length-1-i; j++) {
            if(array1[j]>array1[j+1]){
                int tmp = array1[j+1];
                array1[j+1] = array1[j];
                array1[j] = tmp;
            }
        }
    }
}
public static void main(String[] args) {
    //冒泡排序
    int [] arr = {3,5,10,7,6};
    ArraySorting(arr);
    System.out.println(Arrays.toString(arr));
}*/
/*    public static boolean order(int[] array){
        for (int i = 0; i < array.length-1; i++) {
            if(array[i]>array[i+1]) {
                return false;
            }
            }
        return true;
    }

public static void main(String[] args) {
    int[] array = {1,9,4,2,6};

    System.out.println(order(array));
}*/
/*    public static int binarySearch(int[] array,int key){
        int left = 0;
        int right = array.length-1;
        while(left <= right){
            int mid = (left+right)/2;
            if(array[mid] == key){
                return mid;
            }else if(array[mid] < key){
                left = mid+1;
            }else {
                right = mid-1;
            }
        }
        return -1;
    }*/
/*
public static void main(String[] args) {
        int[] array = {1,2,3,4,5};
    int[] array = {4,2,9,6,3,5};
    int index = Arrays.binarySearch(array,3);
    int index = binarySearch(array,3);
    System.out.println(index);
}
*/
/*public static int[] copyOf(int[] array1,int[] array2) {
    for (int i = 0; i < array1.length; i++) {
            array2[i] = array1[i];
        }
    return array2;
}
public static void main(String[] args) {

    System.out.println("拷贝前");
    System.out.println(Arrays.toString(array1));
    System.out.println(Arrays.toString(array2));
    System.out.println("拷贝后");
    System.out.println(Arrays.toString(array1));

}*/
/*
    public static void main(String[] args) {
        int[] array1 = {4,5,6,7,2,3};
       int[] array2 = Arrays.copyOf(array1,array1.length);
        System.out.println(Arrays.toString(array1));
        System.out.println(Arrays.toString(array2));
    }*/
/*    public static void toString(int[] array1){
        System.out.print("[");
        for (int i = 0; i < array1.length; i++) {
            if(i< array1.length-1){
                System.out.print(array1[i]+",");
            }else{
                System.out.print(array1[i]+"]");
            }
        }
    }*/
/*    public static String toString(int[] array1){
        String ret = "[";
        for (int i = 0; i < array1.length; i++) {
            ret += array1[i];
            if(i != array1.length-1){
                ret += ",";
            }
        }
        ret += "]";
        return ret;
    }
public static void main(String[] args) {
    //实现一个方法 toString, 把一个整型数组转换成字符串.
    //例如数组 {1, 2, 3} , 返回的字符串为 "[1, 2, 3]", 注意 逗号 的位置和数量.
    int[] array1 = {1,2,3};

    System.out.println( toString(array1));
}*/

}
